#ifndef SESSIONMODULE_H
#define SESSIONMODULE_H

#include "ClientMessageHandler.h"
#include "ServerMessageHandler.h"
#include "ShutdownHandler.h"
#include "SessionHandler.h"

#include "resip/stack/NameAddr.hxx"
#include "resip/stack/SipStack.hxx"
#include "resip/stack/SipMessage.hxx"
#include "resip/dum/DialogUsageManager.hxx"
#include "resip/stack/PlainContents.hxx"
#include "resip/dum/PagerMessageHandler.hxx"

#include <iostream>
#include <string>

#define BASEPORT 5060
#define DESTPORT 5070
#define SELECT_TIME 100
#define REG_TIME 70

class Controller;


class SessionModule
{
public:
	// Constructor & Destructor

	SessionModule(resip::DialogUsageManager* dum, resip::SipStack *stack, Controller* parent);
	virtual ~SessionModule();

	void initialize();
	void cleanup();

	void waitForSessionResponse();

	void setScheme(std::string scheme);
	void setBaseUser(std::string user);
	void setDestUser(std::string user);
	void setDestHost(std::string uri);
	void setDestPassword(std::string password);

	void sendInviteMessage(std::string sdp);
	void sendRegularMessage(std::string message);
	void sendByeMessage();

	void shutDown();

private:
	// Memberfunctions

	void initializeHandler();
	void initializeUsers();

	// Membervariables

	SessionHandler* m_sessionHandler;
	ClientMessageHandler* m_clientMessageHandler;
	ServerMessageHandler* m_serverMessageHandler;
	ShutdownHandler* m_shutdownHandler;

	resip::DialogUsageManager* m_dialogUsageManager;
	resip::SipStack* m_stack;

	resip::NameAddr m_baseAor;
	resip::NameAddr m_destAor;

	std::string m_password;

	Controller* m_owner;
};

#endif